package com.house.user.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;


/**
 * Right entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name="t_right")

public class Right  implements java.io.Serializable {


    // Fields    

     private Integer rightId;
     private Integer parentId;
     private String rightName;
     private String description;
     private Set<Role> roles = new HashSet<Role>(0);
     private Set<User> users = new HashSet<User>(0);


    // Constructors

    /** default constructor */
    public Right() {
    }

	/** minimal constructor */
    public Right(Integer parentId, String rightName) {
        this.parentId = parentId;
        this.rightName = rightName;
    }
    
    /** full constructor */
    public Right(Integer parentId, String rightName, String description, Set<Role> roles, Set<User> users) {
        this.parentId = parentId;
        this.rightName = rightName;
        this.description = description;
        this.roles = roles;
        this.users = users;
    }

   
    // Property accessors
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    
    @Column(name="right_id", unique=true, nullable=false)

    public Integer getRightId() {
        return this.rightId;
    }
    
    public void setRightId(Integer rightId) {
        this.rightId = rightId;
    }
    
    @Column(name="parent_id", nullable=false)

    public Integer getParentId() {
        return this.parentId;
    }
    
    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }
    
    @Column(name="rightName", nullable=false, length=20)

    public String getRightName() {
        return this.rightName;
    }
    
    public void setRightName(String rightName) {
        this.rightName = rightName;
    }
    
    @Column(name="description", length=50)

    public String getDescription() {
        return this.description;
    }
    
    public void setDescription(String description) {
        this.description = description;
    }
@ManyToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="rights")

    public Set<Role> getRoles() {
        return this.roles;
    }
    
    public void setRoles(Set<Role> roles) {
        this.roles = roles;
    }
@ManyToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="rights")

    public Set<User> getUsers() {
        return this.users;
    }
    
    public void setUsers(Set<User> users) {
        this.users = users;
    }
   








}